using System.Collections;

namespace ConsoleApp2.input._1023;

public class Demo
{
    public void TestPrint()
    {
        int[] arr = new int[5] { 1, 5, 56, 6, 6 };
        for (int i = 0; i < arr.Length; i++)
        {
            Console.WriteLine(arr[i]);
        }
        string[] sarr = new string[5];
        sarr[0] = "Hello";
        sarr[4] =  "World";
        for (int i = 0; i < sarr.Length; i++)
        {
            Console.WriteLine(sarr[i]);
        }
    }

    public void TestPrint2()
    {
        int[,] arr = new int[3, 3];
        arr[0, 0] = 1;
        arr[1, 1] = 2;
        arr[2, 2] = 2;
        int[,] arr1 = { { 2 ,2,2}, { 3,3,3 }, { 4,4,4 } };
    }

    public void TestPrint3()
    {
        int[]  arr = {1,2,3,3,6,62,3,2,2};
        Array.Sort(arr);
        Array.Reverse(arr);
        foreach (var VARIABLE in arr)
        {
            Console.WriteLine(VARIABLE);
        }
    }
    /**
     * 这里是字典类用来在hashmap and hashtable
     */
    public void TestPrint4()
    {
        Hashtable hashtable = new Hashtable();
        hashtable.Add("name","SciAwe");
        hashtable.Add("age", 21);
        foreach (DictionaryEntry VARIABLE in hashtable)
        {
            Console.WriteLine(VARIABLE.Key+"="+VARIABLE.Value);
        }
    }
    /**
     * 这是冒泡排序！！！
     * 析构这里！
     */
    public void TestPrint5()
    {
        int[] arr = new int[] { 1, 2, 3, 6, 6, 5, 4,8,5};
        for (int i = 0; i < arr.Length-1; i++)
        {
            for (int j = 0; j < arr.Length - i -1; j++)
            {
                if (arr[j]  < arr[j + 1])
                {
                    (arr[j], arr[j + 1]) = (arr[j + 1], arr[j]);
                }
            }
        }
    }
}